<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:form="http://java.sun.com/jsf/composite/components/form"
	template="/templates/include/securedmain.xhtml">

	<ui:define name="content">

		<h:form id="form">
			<h:inputHidden value="true">
				<f:validator validatorId="userValidator" />
				<f:attribute name="email" value="#{email}" />
				<f:attribute name="username" value="#{username}" />
				<f:attribute name="usrid" value="#{editMyProfileBean.selectedUser.id}" />
			</h:inputHidden>


			<p:growl id="growl" showDetail="true" sticky="false" />
			<h:panelGrid columns="2">
				<f:facet name="header">
					<h:outputText value="#{msg['view.useredit.form.head']}:" />
				</f:facet>
				<h:outputLabel for="firstname"
					value="#{msg['properties.user.firstname']}:" />
				<p:inputText value="#{editMyProfileBean.selectedUser.firstName}"
					id="firstname" required="true" />

				<h:outputLabel for="surname"
					value="#{msg['properties.user.surname']}:" />
				<p:inputText value="#{editMyProfileBean.selectedUser.surname}"
					id="surname" required="true" />

				<h:outputLabel for="nickname"
					value="#{msg['properties.user.nickname']}:" />
				<p:inputText value="#{editMyProfileBean.selectedUser.nickname}"
					id="nickname" required="true" binding="#{username}"/>

				<h:outputLabel for="email" value="#{msg['properties.user.email']}:" />
				<p:inputText value="#{editMyProfileBean.selectedUser.email}" id="email"
					required="true" binding="#{email}" />

				<h:outputLabel for="role" value="#{msg['properties.user.role']}:" />
				<p:selectOneMenu value="#{editMyProfileBean.selectedUser.role}"
					effect="fade" id="role" disabled="true">
					<f:selectItems value="#{editMyProfileBean.roleValues}" var="usrRole" />
					<p:ajax event="change" update="@this" />
				</p:selectOneMenu>

				<h:outputLabel value="#{msg['properties.user.implementor']}:" />
				<p:selectOneMenu value="#{editMyProfileBean.selectedUser.implementor}"
					effect="fade" disabled="true">
					<f:selectItems value="#{editMyProfileBean.implementorValues}"
						var="usrImpl" />
					<p:ajax event="change" update="@this" />
				</p:selectOneMenu>

				<f:facet name="footer">
					<p:commandButton id="commitButton" action="#{editMyProfileBean.edit}"
						value="#{msg['view.actions.button.commit']}" update="@form"
						ajax="false" />
				</f:facet>
			</h:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>
